package com.ferry.common.util.concurrent.rejected;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created by daiyong
 */
public class CallPolicy extends AbstractRejectedExecutionHandler {

	public CallPolicy(String threadPoolName, boolean dumpNeeded, String dumpPrefixName) {
		super(threadPoolName, dumpNeeded, dumpPrefixName);
	}

	@Override
	public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
		dumpJvmInfoIfNeeded();
		if (!executor.isShutdown()) {
			r.run();
		}
	}
}
